package main

import (
	"dataStructure/DoublyLinkedList"
	"fmt"
)

func main() {
	list := DoublyLinkedList.NewList[int]()
	list.PushBack(1)
	list.PushFront(2)
	list.PushBack(3)
	list.PushFront(4)
	list.PushBack(5)
	fmt.Println(list.String())

	for iter := DoublyLinkedList.NewIterator(list.FrontNode()); iter.IsValid(); iter.Next() {
		fmt.Println(iter.GetValue())
	}
	//head := list.FrontNode()
	//for head != nil {
	//	v, ok := head.GetValue()
	//	if ok == nil && v == 2 {
	//		break
	//	}
	//	head = head.Next()
	//}
	//list.Insert(head, 11)
	//fmt.Println(list.String())
	//fmt.Printf("len of the list is %d\n", list.Size())
	//v, ok := list.Front()
	//if ok == nil {
	//	fmt.Printf("front of the list is %d\n", v)
	//} else {
	//	fmt.Printf("the list is empty\n")
	//}
	//v, ok = list.Back()
	//if ok == nil {
	//	fmt.Printf("back of the list is %d\n", v)
	//} else {
	//	fmt.Printf("the list is empty\n")
	//}
	//list.PopFront()
	//fmt.Println("after popFront : ", list.String())
	//list.PopBack()
	//fmt.Println("after popBack : ", list.String())
	//
	//for !list.Empty() {
	//	v, ok = list.Front()
	//	if ok == nil {
	//		fmt.Printf("front of the list is %d\n", v)
	//	} else {
	//		fmt.Printf("the list is empty\n")
	//	}
	//	list.PopFront()
	//}
}
